#ifndef SNAKE_H
#define SNAKE_H

#include <QMainWindow>
#include<qpainter.h>
#include<QVector>
#include<qstring.h>
namespace Ui {
    class snakeClass;
    
}

class Snake : public QMainWindow
{
    Q_OBJECT

public:
    explicit Snake(QWidget* parent = 0);
    ~Snake();
    void paintEvent(QPaintEvent* event);
    void InitSnake();
    QRect CreateRect();
    void IsEat();
    void IsHit();


private:
    Ui::snakeClass* ui;
    QVector<QRect> vSnakeRect;
    QRect SnakeHead;
    void keyPressEvent(QKeyEvent* key);
    QTimer* timer;
    bool blsRun;
    bool blsOver;
    QString sDisplay;
    int nDirection;
    QRect food;
    int nScore;
    QString scoreLabel;
};


